package com.summer.learning.feignClient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class GetPublishCourseByIdFallbackFactory implements FallbackFactory<GetPublishCourseById> {
    @Override
    public GetPublishCourseById create(Throwable throwable) {
        return courseId -> {
            // 降级处理逻辑
            log.error("降级方法触发，异常信息: {}", throwable.toString());
            log.error("接口：GetPublishCourseById[getById], CourseId={}，将返回null", courseId);
            return null;
        };
    }
}
